package com.tian.feign;

import com.tian.convert.ChargeBalanceRecordReqDto;
import com.tian.dto.ChargeBalanceRecordDto;
import com.tian.dto.PayNotifyReqDto;
import com.tian.dto.WxPrePayReqDto;
import com.tian.enums.ResultCode;
import com.tian.util.CommonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author tianwc  公众号：java后端技术全栈、面试专栏
 * @version 1.0.0
 * @date 2023年05月12日 13:00
 * 博客地址：<a href="http://woaijava.cc/">博客地址</a>
 */
@Component
public class ChargeBalanceRecordFallback implements FallbackFactory<ChargeBalanceRecordFeignClient> {
    @Override
    public ChargeBalanceRecordFeignClient create(Throwable throwable) {
        return new ChargeBalanceRecordFeignClient() {
            @Override
            public CommonResult<Boolean> prePay(WxPrePayReqDto wxPrePayReqDto) {
                return CommonResult.failed(ResultCode.FALLBACK_FAILED);
            }

            @Override
            public CommonResult<ChargeBalanceRecordDto> selectByOrderNo(ChargeBalanceRecordReqDto chargeBalanceRecordReqDto) {
                return CommonResult.failed(ResultCode.FALLBACK_FAILED);
            }

            @Override
            public CommonResult<Boolean> wxPayNotify(PayNotifyReqDto payNotifyReqDto) {
                return CommonResult.failed(ResultCode.FALLBACK_FAILED);
            }
        };
    }
}
